

#import "fbconnect_c.h"
#import "fbconnect_objc.h"


FBConnectObjC* pFBConnectObjC = nil;

void  FBC_Init  (void)
{
    if(pFBConnectObjC == nil)
    {
        pFBConnectObjC = [FBConnectObjC alloc]; 
        [pFBConnectObjC InitFB];
    }
}

void  FBC_Share  (
                  const char* Name,
                  const wchar_t* Caption,
                  int CaptionCount,
                  const wchar_t* Desc,
                  int DescCount,
                  const char* Link,
                  const char* Image                  
                  )
{
    if(pFBConnectObjC != nil)
    {

            
        NSString *pNSName = [[NSString alloc] initWithUTF8String:Name];
        
        NSString *pNSCaption = [[NSString alloc] initWithBytes: (const void*)Caption 
                                                        length: sizeof(wchar_t) * CaptionCount
                                                      encoding: NSUTF32LittleEndianStringEncoding];


        NSString *pNSDesc = [[NSString alloc] initWithBytes: (const void*)Desc 
                                                     length: sizeof(wchar_t) * DescCount
                                                   encoding: NSUTF32LittleEndianStringEncoding];
        
        NSString *pNSLink = [[NSString alloc] initWithUTF8String:Link];
        NSString *pNSImage = [[NSString alloc] initWithUTF8String:Image];
        
        [pFBConnectObjC Share:pNSName :pNSCaption :pNSDesc :pNSLink :pNSImage];
    }
}

        